<template>
	<view class="">
		<view class="navbar-fixed" :class="title_bg?'actve':''" >
			<!-- 状态栏小程序撑起高度 -->
			<view :style="{height:statusBarHeight+'px'}"></view>
			<view class="navbar-content" :style="{height:navBarHeight+'px'}">
				<view class="navbar-search">
					<view class="imgbox" @tap="$tool.navigateBack()">
						<image class="img-bg" src="/static/icon/fanhui.png" mode=""></image>
					</view>
					<text class="navbar-search_text">{{titleText}}</text>
					<view class="navbar-serach"></view>
				</view>
			</view>
		</view>
		<!-- 需要添加占位符高度  状态栏高度+导航栏高度（否则下面tab会塌陷）-->
		<view v-if="ishowZw" :style="{height:statusBarHeight+navBarHeight+'px'}"></view>
	</view>
</template>

<script>
	import {
		mapGetters
	} from 'vuex'
	export default {
		name:'x-details-nav',
		props:{
			title_bg:{
				type:Boolean,
				default:false
			},
			titleText:{
				type:String,
				default:''
			},
			ishowZw:{
				type:Boolean,
				default:true
			}
		},
		data(){
			return {
				
			}
		},
		computed: {
			...mapGetters(['statusBarHeight', 'navBarHeight', 'windowWidth'])
		},
		methods: {
			ReturnToPrevious() {
				uni.navigateBack({
					delta: -2
				})
			
			},
		}
	}
</script>

<style lang="scss">
	.navbar-fixed {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 99;
		width: 100%;
		background: transparent;
		transition: all 0.3s;
		.navbar-content {
			display: flex;
			justify-content: center;
			align-items: center;
			height: 45px;
			box-sizing: border-box;
	
			.navbar-search {
				position: relative;
				display: flex;
				align-items: center;
				justify-content: center;
				// padding: 0 10px;
				width: 100%;
				height: 30px;
				.imgbox{
					position: absolute;
					left: 0;
					margin: 0 20rpx;
					width: 65rpx;
					height: 65rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					background: rgba(255,255,255,0.3);
					border-radius: 50%;
					image {
						
						width: 40rpx;
						height: 40rpx;
						margin-right: -12rpx;
					}
				}
				
				.img-bg{
					transition: all 0.3s;
				}
				.navbar-search_text {
					font-size: 30rpx;
					opacity: 0;
					transition: all 0.3s;
				}
			}
		}
	
	}
	.navbar-fixed.actve{
		background: #fff;
		box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(0, 0, 0, 0.1);
		.navbar-search_text{
			opacity: 1 !important;
		}
	}
</style>
